package com.single.weblearn.web.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

import com.single.weblearn.dao.ProductDao;
import com.single.weblearn.json.Result;
import com.single.weblearn.json.Uploadrs;

@Controller
public class DelController {
	@Autowired
	private ProductDao dao;
	
	@RequestMapping(value = "/api/delete", method = RequestMethod.POST)
	public ResponseEntity<Result> process(@RequestParam("id") Integer id){
		   dao.removeProduct(id);
		    Result rs = new Result();
	        rs.setCode(200);
	        rs.setMessage("删除成功");
	        rs.setResult(true);
			return new ResponseEntity<Result>(rs,HttpStatus.OK);	
	}
}
